p=0
a = input()
x = len(a)
count = a.count('(')
c1 = a.count(')')
c2 = a.count("[")
c3 = a.count ("]")
c4 = a.count('(')
c5 = a.count('}')
for i in range(len(a)):
    for x in range(len(a)):
        if (a[i] == '(' and a[x] == ')') or (a[i] == '[' and a[x] == ']') or (a[i] == '{' and a[x] == '}'):
            p += 1
if (p == len(a) / 2 and len(a) % 2 == 0) or (count == c1 and c2 == c3 and c4 == c5):
    print("True" )
else:
    print( 'False' )